import {mileSecondToDate} from '../../../assets/js/help.js'
export default {
  data() {
    return {

    }
  },
  methods: {
    getList() {
      let params = $.extend({}, this.searchParams);
      this.getserviceRecordList(params);
    },
    getserviceRecordList(aparams) {
      let self = this,
      params = {
        page: this.pageNumber,
        rp: this.pageSize
      };
      params = $.extend({}, params, aparams);
      API.fetchGet('park/emergency/pageListOfflineAlarmLog.do',params).then(res=>{
        console.log('res:',res)
        self.tbodysInfo = []
        let data = res.data
        let rows = data.rows
        self.total = data.total
        for(let i = 0; i<rows.length; i++){
          let obj = rows[i]
          let tempObj = {}
          tempObj.id = obj.id
          tempObj.clientName = obj.clientName
          tempObj.parkName = obj.parkName
          tempObj.createTime = mileSecondToDate(obj.createTime)
          tempObj.reconnectTime = mileSecondToDate(obj.reconnectTime)
          tempObj.offLineDuration = obj.offLineDuration >> 0
          tempObj.status = obj.status
          self.tbodysInfo.push(tempObj)
        }
      },err=>{})
    },
    exportData() {
      let self = this;
      let theadsArr = []
      for (let i = 0; i < self.theadsInfo.length; i++) {
        if (self.theadsInfo[i].checked) {
          theadsArr.push(self.theadsInfo[i].prop)
        }
      }
      let params = {
        meterList: theadsArr.join(',')
      };

      params = $.extend({}, params, this.searchParams, this.otherParams);
      self.showDialog("确认导出该报表?", '', function () {
        self.toExportAsync('park/emergency/exportOfflineAlarmLog.do', params);
      });
    },
  }
}